package cn.jxwazx.sheinspringboot.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.jxwazx.sheinspringboot.mapper.TaskMapper;
import cn.jxwazx.sheinspringboot.entity.po.Task;
import cn.jxwazx.sheinspringboot.service.TaskService;
/**
 * @author LoveHuaHua
 * @date 2024年04月05日 22:00
 * @description believe in yourself
 */
@Service
public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements TaskService{

    @Override
    public void incrementCount(Task task) {
        Task taskData = getById(task.getId());

        Integer count = taskData.getCount();
        count++;
        taskData.setCount(count);

        if (taskData.getCount() >= 3){
            taskData.setStatus(2);
        }
        updateById(taskData);
    }
}
